﻿using System;
using System.Collections;
using System.Collections.Generic;

namespace NhJump.Persistence
{
    /// <summary>
    /// Always yields zero results.  Null object pattern
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class EmptyEnumerator<T> : IEnumerable<T>, IEnumerator<T>
    {
        public T Current
        {
            get
            {
                throw new InvalidOperationException();
            }
        }
        
        object IEnumerator.Current
        {
            get
            {
                return Current;
            }
        }

        public void Dispose()
        {
        }

        public bool MoveNext()
        {
            return false;
        }

        public void Reset()
        {
        }

        public IEnumerator<T> GetEnumerator()
        {
            return this;
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return this;
        }
    }
}
